<div th:fragment="menu">
<div id="sidebar" >
    <ul id="menu">
        <!-- <li><a href="usersPage"><i class="icon icon-home"></i> <span>用户管理</span></a> </li>
         <li><a href="rolesPage"><i class="icon icon-signal"></i> <span>角色管理</span></a> </li>
         <li><a href="resourcesPage"><i class="icon icon-inbox"></i> <span>资源管理</span></a> </li>-->
    </ul>
</div>
	<script type="text/javascript" th:src="@{/js/jquery-1.11.2.min.js}"></script>
	<script th:src="@{/js/bootstrap.min.js}"></script>
	<script th:src="@{/js/jquery.dataTables.min.js}"></script>
	<script th:src="@{/js/layer.js}"></script>
	<script type="text/javascript" th:src="@{/js/jquery.ztree.core.js}"></script>
	<script type="text/javascript" th:src="@{/js/jquery.ztree.excheck.js}"></script>
	<script th:src="@{/js/common/common.js}"></script>
    <script type="text/javascript">
      $.ajax({
        cache: true,
        type: "get",
        //url:'resources/loadMenu.do',
       url:'resources/loadMenu/1',
        dataType:"json",
        success: function(data) {
            var html="";
            for(var i=0;i<data.length;i++){
                html+="<li><a href='"+data[i].rsUrl+"'><i class='icon icon-home'></i> <span>"+data[i].rsName+"</span></a> </li>"
             }
            $("#menu").append(html);
            //改变当前菜单样式
            $("#menu li a").each(function(){
            $this = $(this);
            if($this[0].href==String(window.location)){
                $this.attr("href","javascript:;");
                $this.parent().addClass("active");
            }
            });
        }
    });


        /*  var zTree;
        var setting = {
          view: {
            dblClickExpand: false,//双击节点时，是否自动展开父节点的标识
            showLine: true,//是否显示节点之间的连线
            fontCss:{'color':'black','font-weight':'bold'},//字体样式函数
            selectedMulti: false //设置是否允许同时选中多个节点
          },
          check:{
            //chkboxType: { "Y": "ps", "N": "ps" },
            chkStyle: "checkbox",//复选框类型
            enable: true //每个节点上是否显示 CheckBox 
          },
          data: {
            simpleData: {//简单数据模式
            enable:true,
            idKey: "id",
            pIdKey: "parentId",
            rootPId: ""
            },
            key:{
      		  name:"rsName"
      	  	}
          },  
          callback: {
            beforeClick: function(treeId, treeNode) {
              zTree = $.fn.zTree.getZTreeObj("menu");
              if (treeNode.isParent) {
                zTree.expandNode(treeNode);//如果是父节点，则展开该节点
              }else{
                zTree.checkNode(treeNode, !treeNode.checked, true, true);//单击勾选，再次单击取消勾选
              }
            }
          }
        };

        $.ajax({
            async:false,
            type : "POST",
            url: "resources/loadMenu.do",
            dataType:'json',
            contentType: "application/json; charset=utf-8",
            success: function(data){
            	//console.log(data);
                $.fn.zTree.init($("#menu"), setting, data);
                var zTree = $.fn.zTree.getZTreeObj("menu");	
                zTree.expandAll(true);
                //$('#menu').modal(); 

            }
        });  */
        
</script>
</div>

